/*******************************************************************************
 * Package: com.practice.utils
 * Type:    SecurityUtils
 * Date:    2023/9/28 10:03
 *
 * Copyright (c) 2023 HUANENG GUICHENG TRUST CORP.,LTD All Rights Reserved.
 *
 * You may not use this file except in compliance with the License.
 *******************************************************************************/
package com.practice.utils;

import com.practice.security.LoginUserInfo;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * Spring Security的工具类
 *
 * @author Masiyu
 * @date 2023/9/28 10:03
 */
public class SecurityUtils {
    /**
     * 获取当前登录人信息
     * @return
     */
    public static LoginUserInfo getLoginInfo(){
       return (LoginUserInfo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    }
}
